package com.chh.pdapp.rule.command;


import com.chh.pdapp.assembler.RuleAssembler;
import com.chh.pdclient.dto.RuleUpdateCmd;
import com.chh.pdclient.dto.data.RuleVO;
import com.chh.pddomain.gateway.RuleGateway;
import com.chh.pddomain.rule.RuleEntity;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


@Slf4j
@Component
@AllArgsConstructor
public class RuleUpdateCmdExe {

    private final RuleGateway ruleGateway;

    public RuleVO execute(RuleUpdateCmd cmd) {
        RuleEntity save = ruleGateway.save(RuleAssembler.toUpdateEntity(cmd));

        return RuleAssembler.toRuleVO(save);
    }
}
